package com.dm.server.MQ;
import com.dm.server.entity.VoucherOrder;
import com.dm.server.service.VoucherOrderService;
import com.dm.server.service.impl.VoucherOrderServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;

import org.springframework.stereotype.Component;

import javax.annotation.Resource;


@Component
@RocketMQMessageListener(consumerGroup = "MyConsumerGroup",topic = "TestTopic")
public class SpringConsumer implements RocketMQListener<VoucherOrder> {
    @Resource
    private VoucherOrderServiceImpl voucherOrderService;

    @Override
    public void onMessage(VoucherOrder voucherOrder) {
        voucherOrderService.handleVoucherOrder(voucherOrder);
    }
}

